<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>


<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!--<%
	String uid = (String)request.getParameter("uid");
	System.out.println(uid);
	request.setAttribute("uid",uid);
	session.setAttribute("uid",uid);
	System.out.println(session.getAttribute("uid"));
%>

--><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'Header1.jsp' starting page</title>
    
	<link type="text/css" rel="stylesheet" href="css/header.css">
	<link type="text/css" rel="stylesheet" href="css/common.css">
	<link type="text/css" rel="stylesheet" href="css/list.css">

	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	
	<script type="text/javascript" src="javascript/jquery-1.4a2.min.js"></script>
	<script type="text/javascript" src="javascript/togobuilding.js"></script>
	<script type="text/javascript" src="javascript/tip.js"></script>
	<script type="text/javascript" src="javascript/jCommon.js"></script>
	<script type="text/javascript" src="javascript/jquery.select.js"></script>
	<script type="text/javascript" src="javascript/jquery.cycle.js"></script>
	<script type="text/javascript">

$(document).ready(function(){
	
	var uid = "<%=uid%>";
	if("hcu" == uid){
		$("#uname").html("商大江北区");
	}

}); 

	
function gosearch() {
    var key = $(".jtext");
    var mykey = key.val();
    
    if (mykey == "输入您想找的商家名称或地址等..." || key.val() == "") {
        var url = "";
        var num = $("#tbsearchtype").val();
        switch (num) {
            case "1":
                url = "/search.do?method=searchRestaurant&uid=<%=uid%>";
                break;
            case "2":
                url = "/search.do?method=searchDish&uid=<%=uid%>";
                break;
            case "3":
                url = "/bld.aspx";
                break;
        }
        var objpath = window.location + "";
        if (objpath.toLowerCase().indexOf("localhost") > 0) {
            url = "/web" + url;
        }
        window.location = url;
        return true;
    }
    else {
        var url = "";
        var num = $("#tbsearchtype").val();
        switch (num) {
            case "1":
                url = "search.do?method=searchDish&uid=<%=uid%>&keyword=" +  encodeURI(encodeURI(mykey));
                break;
            case "2":
                
                url = "search.do?method=searchRestaurant&uid=<%=uid%>&keyword=" + encodeURI(encodeURI(mykey));
                break;
            case "3":
                url = "/bld.aspx?keyword=" + escape(mykey);
                break;
        }
        var objpath = window.location + "";
        if (objpath.toLowerCase().indexOf("localhost") > 0) {
            url =  url;
        }
        window.location = url;
        return true;
    }
}



</script>
  </head>
  
  <body>
    <div class="top">
<div class="wrap">
<c:choose>

   <c:when test="${user==null}">  
      <div id="head_divNologin" class="top_left" style="display:;">您好，欢迎来订餐！ <a href="<%=basePath%>login.jsp" class="black">[登录]</a> <a href="<%=basePath%>register.jsp" class="orange"&nbsp;>[注册]</a></div>
   </c:when>
   
   <c:otherwise> 
   	<div id="head_divLoinged" class="top_left" "><strong id="head_spanuser" class="orange"></strong> 您好[${user.name}]，欢迎来订餐！ <a href="/userhome/MyAddress.aspx" target="_blank">[会员中心]</a><a href="#" id="head_header_notice_num" target="_blank" class="notice_num" title="未查看通知">0</a><span><a href="<%=basePath%>user.do?m=logout">
[退出]</a></span></div>
   </c:otherwise>
  
</c:choose>




</div>
</div>
<div class="header">
    <div class="wrap">
      
        <div class="fn-clear">
            <div class="logo">
                <a href="#" id="top_logolink" title="饭易得外卖网">
                    <img src="images/logo.jpg" id="top_logoimg" style="width: 178px; height: 75px;"></a>
            </div>
            <div style="margin-left:10px;padding-left:8px;float:left;margin-top:35px;background:url(http://img01.taobaocdn.com/tps/i1/T1G_BSXspdXXbReZ6r-1-2.png) repeat-y 0 0">
                
                <a href="http://life.taobao.com/market/life/city_page.php">
				<span id ="uname" style="display:block;font-size:20px;line-height:22px">选择校区</span>
                    </a>
                <a href="http://life.taobao.com/market/life/city_page.php">     
				 <span style="font-size:normal;font:tahoma,arial,\5b8b\4f53;color:#b3b3b3">[校区切换]</span>
                </a>
                    
            </div>
            <div class="search">
                <div class="bg">
                    <div class="search_class" id="head_searchtype_step1" onclick="show_searchtype_head()">
                        <a href="javascript:" id="a_current_lable">搜菜品</a>                    </div>
                    <div style="display: none;" class="search_class_hover" id="head_searchtype_step2">
                        <a class="search_class_a">搜小店</a>
                        <ul>
                            <li style="line-height: 24px;"><a href="javascript:set_searchtype(1,'搜菜品')">搜菜品</a></li>
                            <li style="border-bottom: 2px solid #e3e3e3; line-height: 24px;"><a href="javascript:set_searchtype(2,'搜小店')">
                                搜小店</a></li>
                        </ul>
                        <input id="tbsearchtype" value="1" type="hidden">
                    </div>
                    <input name="" class="search_text jtext" value="输入您想找的商家名称或地址等..." onfocus="if(value=='输入您想找的商家名称或地址等...') {value=''}" onblur="if (value=='') {value='输入您想找的商家名称或地址等...'}" type="text">
                    <input name="" class="search_btn" onclick="gosearch()" type="button"/>
                  </div>
            </div>
       </div>
    </div>
</div>
<div class="nav">
    <div class="wrap">
        <div class="nav_left">
            <ul>
                <li class="nav_hover" id="nav_li1"><a href="#">首 页</a></li>
                <li class="" id="nav_li2"><a href="<%=basePath%>showfd.do?method=getAllRest&uid=<%=uid%>">外卖小店</a></li>
                <li id="nav_li6"><a href="<%=basePath%>comment.jsp">江湖点评</a></li>
            </ul>
        </div>
        <div class="hot_phone">
            <p>
                在线服务</p>
            <h4>
                QQ-67134972</h4>
        </div>
    </div>
</div>

<script type="text/javascript">
    function show_searchtype_head() {
        $("#head_searchtype_step1").hide();
        $("#head_searchtype_step2").show();
    }

    //设置搜索类型
    function set_searchtype(type, mytext) {
        $("#head_searchtype_step1").show();
        $("#head_searchtype_step2").hide();
        $("#tbsearchtype").val(type);
        $("#a_current_lable").html(mytext);
        if (type == 1) {
            $("#tb_searchkey_2").hide();
            $("#tb_searchkey_1").show();
        }
        else {
            $("#tb_searchkey_1").hide();
            $("#tb_searchkey_2").show();
        }
    }         
</script>
  </body>
</html>
